Function Reference

UDPBind

Create a socket bound to an incoming connection.

UDPBind ( IPAddr, port )

 

Parameters

IPAddr Internet Protocol dotted address(IpV4) as "192.162.1.1".
port port on which the created socket will be bound.

 

Return Value

Success: Returns an array : $array[1] contains the real socket, $array[2] contains the specified IP address and $array[3] contains the port. We need this information in subsequent calls to UDPSend(), where we pass this socket structure/array.
Failure: Returns -1 and set @error according to WSAGetLasterror Windows API return.
If IPAddr is incorrect @error is set to 1.
If port is incorrect @error is set to 2.

 

Remarks

None.

 

Related

UDPRecv, UDPOpen

 

Example


;SERVER!! Start Me First !!!!!!!!!!!!!!!
$g_IP = "127.0.0.1"

; Start The UDP Services
;==============================================
UDPStartUp()

; Create a Listening "SOCKET"
;==============================================
$socket = UDPBind($g_IP, 65432)
If @error <> 0 Then Exit